/**
 * 前端弹窗
 * @param   param	参数对象 	
 * type 	弹窗类别		1：普通弹窗，2：成功弹窗，3：警告弹窗，4：错误弹窗
 * msg	       弹窗文字	
 * time    	弹窗持续时间
 * fn		回调函数
 */
function _msg(param){
	var c='';		//弹窗样式类
	var m='提示';		//弹窗文字
	var t=2000;	//弹窗持续时间
	var fn=null;
	if(param!=undefined){
		if(typeof param == 'string'){
			m=param;
		}else{
			switch(param['type']){
				case 1:
					c='<i style="color:#d8d8d8" class="weui-icon-info-circle weui-icon_msg weui-icon_toast""></i>';
				break;
				case 2:
					c='<i class="weui-icon-success weui-icon_msg weui-icon_toast""></i>';
				break;
				case 3:
					c='<i class="weui-icon-warn weui-icon_msg weui-icon_toast""></i>';
				break;
				case 4:
					c='<i class="weui-icon-cancel weui-icon_msg weui-icon_toast""></i>';
				break;
				default:
					c='';
			}
			m	= !param['msg'] ? '提示' : param['msg'];
			t 	= !param['time'] ? 2000 : param['time'];
			fn 	= !param['fn'] ? null : param['fn'];	
		}
	}
	$('body').remove('#toast');
	var _win='<div id="toast" style="display:none">'+
	        '<div class="weui-mask_transparent"></div>'+
		        '<div class="weui-toast" style="line-height:1.5rem;">'+c+
		            '<p class="weui-toast__content" style="color:#fff;">'+m+'</p>'+
		        '</div>'+
		    '</div>';
	$('body').append(_win);
	$('#toast').fadeIn(100);
	setTimeout(function () {
		if(fn){
			$('#toast').fadeOut(100,fn());	
		}else{
			$('#toast').fadeOut(100);
		}
    }, t);
}
